package com.magic.mapstruct;

import com.magic.dto.StudentDto;
import com.magic.vo.StudentVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @Description
 * @Author chenjie
 * @DATE 2019/8/8 13:58
 */
@Mapper
public interface StudentListConvert {

    StudentListConvert INSTANCE = Mappers.getMapper(StudentListConvert.class);

    /**
     * 实体转换映射
     */
    @Mappings({
            @Mapping(target = "stuName", source = "name"),
            @Mapping(target = "id",source = "id",resultType = Integer.class)
    })
    StudentVo vo2Dto(StudentDto studentDto);

    List<StudentVo> vos2Dtos(List<StudentDto> studentDtos);
}
